package common.plugins.pay;

import android.app.Activity;

import com.tekj.cxqcb.operation.resultBean.MemberUpgradePayBean;
import com.tencent.mm.opensdk.modelpay.PayReq;

import common.base.MainApplication;


/**
 * description: 获取微信支付参数，并调起微信支付
 * autour: tongzhenggang@126.com
 * date: 2017/8/9
 */
public class GetWeixinParameter {

    private Activity mActivity;

    /**
     * description:   //服务端统一下单，https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1
     * // 获取APP端调起支付的参数列表https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2
     * autour: tongzhenggang@126.com
     * date: 2017/11/7
     */
    public GetWeixinParameter(Activity activity, MemberUpgradePayBean.DataBean.WxpayBean data) {
        this.mActivity = activity;

        PayReq request = new PayReq();
        request.appId = data.getAppid();//"wx9409b172842c7d01";// 微信开放平台审核通过的应用APPID
        request.prepayId = data.getPrepayid();// "wx20180309180535c6c7d9a1b70581233170";// 预支付订单号，app服务器调用“统一下单”接口获取
        request.nonceStr = data.getNoncestr();//"0m1t6naar3mbiqh948olgnfu17x8zc87";// 随机字符串，不长于32位，服务器小哥会给咱生成
        request.sign = data.getSign();// "971EF098D1C11E9A0118228568D275D2";//签名，服务器小哥给出，他会根据：https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_3指导得到这个
        request.packageValue = "Sign=WXPay";//"Sign=WXPay";// 固定值Sign=WXPay，可以直接写死，服务器返回的也是这个固定值
        request.partnerId = data.getPartnerid();//"1499643082";// 微信支付分配的商户号
        request.timeStamp = data.getTimestamp() + "";//"1520589954";// 时间戳，app服务器小哥给出
        MainApplication.api.sendReq(request);

    }
}
